<template>
	<view class="content">
		<u-tabbar :value="currentTab" :fixed="true" :placeholder="false" :border="false" v-if="type == 0" zIndex="9999"
			activeColor="#000000" inactiveColor="#666666">
			<u-tabbar-item @click="goBack(item.pagePath)" v-for="(item, index) in list" :key="item.pagePath"
				:text="item.text">
				<view slot="active-icon" class="box" v-show="item.text">
					<image :src="item.selectedIconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false"
						class="icon" />
				</view>
				<view slot="inactive-icon" class="box" v-show="item.text">
					<image :src="item.iconPath" mode="aspectFit|aspectFill|widthFix" lazy-load="false" class="icon" />
				</view>
				<view slot="inactive-icon" style="width: 600rpx;height: 100rpx;" class="box" v-show="!item.text">
					<image src="/static//insert_btn.png" mode="aspectFit|aspectFill|widthFix" lazy-load="false"
						class="icon" />
				</view>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		name: 'tabbar',
		props: ['currentTab', 'type', 'scroll'],
		data() {
			return {
				list: [{
					"pagePath": "/pages/index/index",
					"iconPath": "/static/home.png",
					"selectedIconPath": "/static/homeA.png",
					"text": "首页"
				}, {
					"pagePath": "/pages/pocketShop/shopping/index",
					"iconPath": "/static/add.png",
					"selectedIconPath": "/static/add.png",
					"text": ""
				}, {
					"pagePath": "/pages/mine/index",
					"iconPath": "/static/mine.png",
					"selectedIconPath": "/static/mineA.png",
					"text": "我的"
				}],

			}
		},
		methods: {
			goSwitch(url) {
				if (url) {
					this.$goPath(3, url)
				} else {
					this.$emit('scrollTop', true)
				}
			},
			goBack(url) {
				if (url) {
					this.$goPath(2, url)
				} else {
					this.$emit('scrollTop', true)
				}
			}
		}
	}
</script>

<style lang="scss">
	.icon {
		width: 50rpx;
		height: 50rpx;
	}
</style>